package com.nineclock.message.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.message.MessageControllerApi;
import com.nineclock.message.dto.NcMessageDTO;
import com.nineclock.message.pojo.NcMessage;
import com.nineclock.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
@RestController
@RequestMapping("/message")
public class MessageController implements MessageControllerApi {

    @Autowired
    MessageService messageService;

    @Override
    @GetMapping
    public Result<List<NcMessage>> findMessageRecord(NcMessageDTO messageDTO) {

        List<NcMessage> messageList = messageService.findMessageRecord(messageDTO);
        return Result.success(messageList);
    }
}
